#!/usr/bin/python
# -*- coding: utf-8 -*-


#from pardus import Package
from noplatform import *
from liburl import Download
#import pisi

#pkg = Package()


"""deps = pkg.getPackageDeps(['mono'])
for dep in deps:
	print(dep)

print pkg.getXml(deps)"""


#updateList = pkg.getUpdateList()

#print updateList

#pkg.createXML(['mono'])

#print pkg.getInstalledPackages()


"""pkgs = parsePisiIndex("pisi-index3.xml")

for i in pkgs:
    print("name   : %s\nversion: %s\nrelease: %s" % (i, pkgs[i][0], pkgs[i][1]))"""


#pkg.getInstalledPackages()
''' structure example
        {
            "contrib": {"pkg2" : ("pkg1, "1.0", "2"), "pkg2" : ("pkg2", "3.5", "4")},
            "pardus-2009" : {"pkg2" : ("pkg1, "1.0", "2"), "pkg2" : ("pkg2", "3.5", "4")}
        }
    '''
"""print("Parse Installed Package XML...")
currentDB = parseInstalledPackageXML("asd.xml")
for i, a in currentDB.items():
	print i
	for i,j in a.items():
		print "\t"+i, j[0],j[1],j[2],j[3]"""
	
"""print("Parse Pisi Index XML...")
freshDB = parsePisiIndex("pisi-index3.xml")

print("Calculate Updates...")
updates = getUpdatedPackages(currentDB, freshDB)
try:
    print("Length %s" % updates.length)
except:
    pass

for pkg in updates:
    print "name : %s\nversion : %s\nrelease : %s\n"%(pkg[0], pkg[1], pkg[2])"""

getFreshPiSiIndex("installed.xml")

#writeUpdatedPackages("installed-package.xml", "freshPiSiList.xml")

#print checkInternet()
